<template>
  <view>
    <search-components ref="searchInputRef"></search-components>
    <layout-page :size="20">
      <template #default>
        <load-data
          :categoryList="categoryList"
          :positions="'select'"
          :select-tab="searchInput"
        ></load-data>
      </template>
    </layout-page>
  </view>
</template>

<script setup lang="ts">
import SearchComponents from '@/layout/components/SearchComponents.vue'
import { onLoad, onReady } from '@dcloudio/uni-app'
import { ref } from 'vue'
import LoadData from '@/layout/PageItemComponents/loadData.vue'
import LayoutPage from '@/layout/LayoutPage.vue'

const searchInputRef = ref()
const searchInput = ref('')
const categoryList = ref([
  {
    id: 0,
    title: '帖子'
  },
  {
    id: 1,
    title: '用户'
  },
  {
    id: 2,
    title: '话题'
  }
])
onLoad((query) => {
  if (query && query.keyword) {
    searchInput.value = query.keyword
  }
})
onReady(() => {
  searchInputRef.value.searchInput = searchInput.value
})
</script>

<style scoped lang="scss"></style>
